home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / programming / amos / amossible / structures / whilewend.amos / whilewend.amosSourceCode
Encoding:
AMOS Source Code  |  1980-05-17  |  1.1 KB  |  24 lines

  1. '********************WEND WILL I SEE YOU AGAIN?-By Mark Wickson******************* 
  2. Rem As with other loops,the "While...Wend" structure can be used to perform
  3. Rem tasks repeatedly,but the special thing about these commands is that you
  4. Rem can exit from the loop if a certain condition is achieved. 
  5. Rem First you write: 
  6. Rem While
  7. Rem and then you write the condition for the loop to continue-So you might 
  8. Rem want it to continue if a variable is less than a certain number-In this
  9. Rem example we use the variable "X"-Making the loop continue until "X" 
  10. Rem equals 100,like this:
  11. Rem While X<=100 
  12. Rem after this you write the various commands inside the loop,in this example, 
  13. Rem we print the current value of "X",add 1 to the "X" variable,and wait point 
  14. Rem five of a second before beoing sent back to "While" with "Wend"-"While"
  15. Rem then checks to see if the certain condition is still in operation- 
  16. Rem In this case if "X" is equal to or less than 100 the loop continues. 
  17. Rem When the conditions change(here,it would mean X=100) the loop is ended and 
  18. Rem the program continues. 
  19. X=0
  20. While X<=100
  21.    Print At(0,0);X
  22.    X=X+1
  23.    Wait 5
  24. Wend